package com.qiaoyanqing.ximalaya.discovermodule.discover_adapter;

import android.widget.TextView;


        import android.content.Context;
        import android.view.LayoutInflater;
        import android.view.View;
        import android.view.ViewGroup;
        import android.widget.BaseAdapter;
        import android.widget.ImageView;
        import android.widget.TextView;

        import com.qiaoyanqing.ximalaya.R;
        import com.qiaoyanqing.ximalaya.discovermodule.discover_entity.DiscoverSpecialEntity;
import com.qiaoyanqing.ximalaya.util.CircleTransform;
import com.squareup.picasso.Picasso;

        import java.util.List;

/**
 * Created by Administrator on 2016/12/11.
 */

public class DiscoverRecommendSpecialLVadapter extends BaseAdapter {
    private List<DiscoverSpecialEntity.ListBean> mData;
    private Context mContext;

    public DiscoverRecommendSpecialLVadapter(List<DiscoverSpecialEntity.ListBean> data, Context context) {
        mData = data;
        mContext = context;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int i) {
        return mData.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder=null;
        if (view == null) {
            holder=new ViewHolder();
            view= LayoutInflater.from(mContext).inflate(R.layout.spelvview,viewGroup,false);
            holder.imageview= (ImageView) view.findViewById(R.id.showimage);
            holder.title= (TextView) view.findViewById(R.id.showtitle);
            holder.subtitle= (TextView) view.findViewById(R.id.spesubtitle);
//            holder.num1= (TextView) view.findViewById(R.id.showplatcount);
//            holder.num3= (TextView) view.findViewById(R.id.showmsg);

            view.setTag(holder);
        }else {

            holder= (ViewHolder) view.getTag();

        }
        //赋值
        holder.title.setText(mData.get(i).getTitle());
        holder.subtitle.setText(mData.get(i).getNickname());
        //    holder.num1.setText((int) mData.get(i).getPlaysCounts()/10000+"万");

        Picasso.with(mContext).load(mData.get(i).getCoverSmall()).transform(new CircleTransform()).into(holder.imageview);
        return view;
    }

    static class ViewHolder{
        ImageView imageview;
        TextView title,subtitle,num1,num2,num3,time;


    }

}
